<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button> 向右移动 </button>
    <div style="background-color:red;width:50px;height:50px;position:absolute;"></div>
    <script src="jquery-3.7.1.slim.min.js">
        $("button").click(function() {
            $("div").animate({
                left: 100,
            }, 500);
        });
        $("button").click(function() {
            $("div").animate({
                left: 0,
            }, 500);
        });
    </script>
</body>

</html>